package com.chenyaowei.member.mapper;

import java.util.List;
import com.chenyaowei.common.utils.DateUtils;
import com.chenyaowei.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.chenyaowei.member.mapper.CywMemberCollectSpuMapper;
import com.chenyaowei.member.domain.CywMemberCollectSpu;
import com.chenyaowei.member.service.ICywMemberCollectSpuService;

/**
 * 会员收藏的商品Service业务层处理
 *
 * @author 陈耀威
 * @date 2023-12-03
 */
@Service
public class CywMemberCollectSpuServiceImpl implements ICywMemberCollectSpuService
{
    @Autowired
    private CywMemberCollectSpuMapper cywMemberCollectSpuMapper;

    /**
     * 查询会员收藏的商品
     *
     * @param id 会员收藏的商品主键
     * @return 会员收藏的商品
     */
    @Override
    public CywMemberCollectSpu selectCywMemberCollectSpuById(Long id)
    {
        return cywMemberCollectSpuMapper.selectCywMemberCollectSpuById(id);
    }

    /**
     * 查询会员收藏的商品列表
     *
     * @param cywMemberCollectSpu 会员收藏的商品
     * @return 会员收藏的商品
     */
    @Override
    public List<CywMemberCollectSpu> selectCywMemberCollectSpuList(CywMemberCollectSpu cywMemberCollectSpu)
    {
        return cywMemberCollectSpuMapper.selectCywMemberCollectSpuList(cywMemberCollectSpu);
    }

    /**
     * 新增会员收藏的商品
     *
     * @param cywMemberCollectSpu 会员收藏的商品
     * @return 结果
     */
    @Override
    public int insertCywMemberCollectSpu(CywMemberCollectSpu cywMemberCollectSpu)
    {
        return cywMemberCollectSpuMapper.insertCywMemberCollectSpu(cywMemberCollectSpu);
    }

    /**
     * 修改会员收藏的商品
     *
     * @param cywMemberCollectSpu 会员收藏的商品
     * @return 结果
     */
    @Override
    public int updateCywMemberCollectSpu(CywMemberCollectSpu cywMemberCollectSpu)
    {
        return cywMemberCollectSpuMapper.updateCywMemberCollectSpu(cywMemberCollectSpu);
    }

    /**
     * 批量删除会员收藏的商品
     *
     * @param ids 需要删除的会员收藏的商品主键
     * @return 结果
     */
    @Override
    public int deleteCywMemberCollectSpuByIds(Long[] ids)
    {
        return cywMemberCollectSpuMapper.deleteCywMemberCollectSpuByIds(ids);
    }

    /**
     * 删除会员收藏的商品信息
     *
     * @param id 会员收藏的商品主键
     * @return 结果
     */
    @Override
    public int deleteCywMemberCollectSpuById(Long id)
    {
        return cywMemberCollectSpuMapper.deleteCywMemberCollectSpuById(id);
    }

    @Override
    public CywMemberCollectSpu selectInfoByMemberIdAndSpuId(Long userId, Long spuId) {
        return cywMemberCollectSpuMapper.selectInfoByMemberIdAndSpuId(userId, spuId);
    }

    @Override
    public int deleteCurrentMemberCollectBySpuId(Long userId, Long spuId) {
        return cywMemberCollectSpuMapper.deleteCurrentMemberCollectBySpuId(userId, spuId);
    }
}
